package com.itheima.demo2generic;

import java.util.ArrayList;

public class Test {

    public static void main(String[] args) {

        ArrayList<Car> cars = new ArrayList<>();
        cars.add(new XiaoMi("XiaoMi", 100000));
        cars.add(new BYD("BYD", 100000));
        cars.add(new BMW("BMW", 100000));
        go(cars);
    }

    public static void go(ArrayList<? extends Car> cars){

        for (Car car : cars) {
            car.run();
        }
    }
}
